package com.itboye.jinpuyiyuan.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.itboye.jinpuyiyuan.R;
import com.itboye.jinpuyiyuan.bean.BranchBean;
import com.itboye.jinpuyiyuan.bean.TestServerOrder;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/12/12 0012.
 */

public class TestServerOrderAdapter extends BaseAdapter {
    private ArrayList<TestServerOrder> list;
    private Context context;
    private LayoutInflater inflater;
    public  TestServerOrderAdapter(Context context,ArrayList<TestServerOrder> list){

        this.list=list;
        this.context=context;
        inflater=LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
       MyViewHolder myViewHolder;
        if (convertView==null){
            myViewHolder=new MyViewHolder();
            convertView=inflater.inflate(R.layout.item_testserver_order,parent,false);
            myViewHolder.orderConfirm=convertView.findViewById(R.id.orderConfirm);
            myViewHolder.orderState=convertView.findViewById(R.id.orderState);
            myViewHolder.orderPersonNum=convertView.findViewById(R.id.orderPersonNum);
            myViewHolder.orderDate=convertView.findViewById(R.id.orderDate);
            myViewHolder.orderWeekday=convertView.findViewById(R.id.orderWeekday);
            convertView.setTag(myViewHolder);
        }else {
            myViewHolder= (MyViewHolder) convertView.getTag();
        }
        myViewHolder.orderState.setText(list.get(position).getOrderState());
        myViewHolder.orderPersonNum.setText(list.get(position).getOrderPersonNum()+"");
        myViewHolder.orderDate.setText(list.get(position).getOrderDate());
        myViewHolder.orderWeekday.setText(list.get(position).getOrderWeekday());

        return convertView;
    }

    class MyViewHolder{
        TextView orderConfirm,orderState,orderPersonNum,orderDate,orderWeekday;
    }
}
